package com.thinkingcoder.tcconfig.demo;

import java.util.Map;
import java.util.TreeMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TcConfigDemoController {

    @Value("${tc.a}.${tc.c}")
    private String a;

    @Value("${tc.b}")
    private String b;

    @Autowired
    private TcConfigDemoProperties configDemoProperties;

    @GetMapping("/demo")
    public Map<String, String> demo() {
        Map<String, String> map = new TreeMap<>();

        map.put("a", a);
        map.put("b", b);
        map.put("configDemoProperties.a", configDemoProperties.getA());
        map.put("configDemoProperties.b", configDemoProperties.getB());

        return map;
    }
}
